using System;
using UnityEngine;
using UnityEngine.UI;

namespace CGF
{
    //该脚本自动生成或覆盖，不可编辑
    public partial class PanelLeasePay
    {   
		public Image Dialog;
		public CButton BtnClose;
		public Text TextTitle2;
		public Text PriceVIP;
		public Text PriceDefault;
		public Text Balance;
		public CButton BtnPay;
		public Switch SwitchButton;
		public CButton TextPrivacy;
		public RectTransform Device;
		public I18N i18n;

        public Reference reference { get; private set; }
        public Action onProsBindCompleted;
        public bool isProsBindCompleted;
        
        public void BindProperties(Transform transform)
        {   
            reference = transform.GetComponent<Reference>();
            if(!reference)return;
            int nodeIndex = 0;
			Dialog = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Image>();
			BtnClose = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			TextTitle2 = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			PriceVIP = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			PriceDefault = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			Balance = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			BtnPay = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			SwitchButton = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Switch>();
			TextPrivacy = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			Device = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<RectTransform>();
			i18n = transform.GetComponent<I18N>();
            isProsBindCompleted = true;
            onProsBindCompleted?.Invoke();
        }
        
        public void SetProsBindCompletedAction(Action action)
        {
            if (isProsBindCompleted)
            {
                action?.Invoke();
            }
            else
            {
                onProsBindCompleted = action;
            }
        }

		public string I18N_suer_privacy { get { return i18n.GetTextByKey("suer_privacy"); } }
		public string I18N_goto_rechage { get { return i18n.GetTextByKey("goto_rechage"); } }
		public string I18N_balance_not_enough { get { return i18n.GetTextByKey("balance_not_enough"); } }
		public string I18N_lease_success { get { return i18n.GetTextByKey("lease_success"); } }
		public string I18N_must_agree { get { return i18n.GetTextByKey("must_agree"); } }
    }
}
